package com.wc.算法基础课.E第五讲动态规划.状压DP.飞机降落;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/27 22:41
 * @description https://www.acwing.com/problem/content/4960/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 15, M = 1 << N;
    // f[i]表示状态i当中位置为1的已经降落，并且最后最前的时间是f[i]的
    static int[] f = new int[M];
    static int INF = 0x3f3f3f3f;
    static int[][] a = new int[N][3];
    static int T, t, d, l, n;

    public static void main(String[] args) {
        T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 3; j++) {
                    a[i][j] = sc.nextInt();
                }
            }
            Arrays.fill(f, 0, 1 << n, INF);
            f[0] = 0;
            for (int i = 1; i < 1 << n; i++) {
                for (int j = 0; j < n; j++) {
                    if ((i >> j & 1) == 1) {
                        t = a[j][0];
                        d = a[j][1];
                        l = a[j][2];
                        // 相当于让第i架飞机起飞
                        int last = f[i - (1 << j)];
                        if (t + d >= last) {
                            f[i] = Math.min(f[i], Math.max(last, t) + l);
                        }
                    }
                }
            }
            out.println(f[(1 << n) - 1] < INF ? "YES" : "NO");
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
